# -*- coding: utf-8 -*-


class IMSI():

    @staticmethod
    def is_valid(imsi, raise_error=False):
        if not imsi.isdigit():
            if raise_error:
                raise TypeError('only digit allowed in IMSI')
            else:
                return False

        if len(imsi) <= 15:
            return True

        if raise_error:
            raise TypeError('IMSI should be 15 digits or shorter')
        else:
            return False
